import { memo } from "react"
import { Link } from 'react-router-dom'
import ArticleAction from "./ArticleAction"
const ArticleHeader =(props)=>{

    const {article,isOwn} = props
    const {avatar,username} = article.author
    return(
        <div className="article-meta">
            <div className="info">
            <Link to='/{username}/profile'>
                <img src={avatar||'https://gu0nuli.github.io/reactStatic/react_static/v1_111.jpg'} alt={username}></img>
            </Link>
            </div>
            <div className="info">
            <Link to='/{username}/profile' className='author'>
                {username}
            </Link>
            <span>
                {new Date(article.createdAt).toDateString()}
            </span>
            </div>

            <ArticleAction isOwn={isOwn} slug={article.slug} />
        </div>
    )
}

export default memo(ArticleHeader)